import request from "./request";
import {getToken} from "@/utils/auth";
/*订单管理
Order Controller
*/

// 用户提交订单
export function addOrderApi( ) {
    return request({
        url: '/order/add' ,
        method: 'POST',
    })
}

//根据店家ID查询所有订单
export function getOrderByBusinessIdApi( ) {
    return request({
        url: '/order/businessGet/'+getToken() ,
        method: 'GET',
    })
}


//根据订单ID查询订单
export function getOrderByIdApi(id: any) {
    return request({
        url: '/order/getById/' + id,
        method: 'GET',
    })
}


// 根据用户ID查询用户订单
export function getOrderByUserIdApi(id: any) {
    return request({
        url: '/order/userGet/' + id,
        method: 'GET',
    })
}


// 修改订单状态 订单状态 1已付款，2已出餐待派送，3已接单，4已派送，5已完成，6已取消
export function editOrderApi(data: any) {
    return request({
        url: "/order/updateStauts",
        method: 'PUT',
        data
    })
}


